package abc.hd.com.dao;

import abc.hd.com.entity.bookes;
import abc.hd.com.entity.bookuser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface daouser {
    @Select ("select * from book_info a,book_type b where a.book_type=b.id")
    List<bookes> getalldata();
    //根据用户名和密码进行查找
    @Select ("select * from users where user_code=#{name} and password=#{paw}")
    bookuser getdataone(@Param ("name") String name,@Param ("paw") String mm);
    //添加用户
    @Insert ("insert into users values(default,#{user_code},#{password},#{email},#{gender},#{register_time},#{last_logintime})")
    int insertdata(bookuser a);
    //查询全部书籍信息
    @Select ("select * from book_info a,book_type b where a.book_type=b.id")
    List<bookes> querydall();
    //根据id查找
    @Select ("select * from book_info where book_id=#{id}")
    bookes querydataidone(@Param ("id") int id);
    //修改状态
    @Update ("update book_info set is_borrow=#{i} where book_id=#{id} ")
    int updatadata(@Param ("i") int i,@Param ("id") int id);
}
